package utilities;

import java.io.IOException;
import java.io.PrintStream;

import sun.net.smtp.SmtpClient;

public class EnviaEmail {



	public boolean enviar() {

		String to = "paianck90@gmail.com";

		String from = "paianck90@gmail.com";

		try {
		SmtpClient client = new SmtpClient("smtp.gmail.com");  //servidor smtp
		client.from(from);
		client.to(to);
		PrintStream msg = client.startMessage();
		msg.println("to:" + to);
		msg.println("from:" + from);
		msg.println ("Subject:Exemplo de Envio de e-mail");
		msg.print("\r\n");
		msg.println("Testando de email  http://gregui.wordpress.com");

		client.closeServer();
		} catch (IOException e) {
		System.out.println(e.getMessage());
		return false;
		}
		return true;
		}
}
